{// 引入标签库 }
<tagLib name="html" />
<include file="Public:header" />
<div class="main">
    <div class="main_title">{%ADD} <a href="{:u("Xiacai/index")}" class="back_list">{%BACK_LIST}</a></div>
    <div class="blank5"></div>
    <form name="add" action="__APP__" method="post" enctype="multipart/form-data">
        <table class="form" cellpadding=0 cellspacing=0>
            <tr>
                <td colspan=2 class="topTd"></td>
            </tr>
            <tr>
                <td class="item_title">节目名称:</td>
                <td class="item_input"><input type="text" class="textbox require" name="subject" value="瞎猜135" /></td>
            </tr>
            <tr>
                <td class="item_title">节目简介:</td>
                <td class="item_input"><textarea name="desc" class="textarea require">节目简介测试</textarea></td>
            </tr>
            <tr>
                <td class="item_title">规则介绍:</td>
                <td class="item_input"><textarea name="rule_intro" class="textarea require" style="height:60px;">每个礼品都有一个正确价格，主持人会给出提示，玩家花费1000钻可进行一次价格竞猜。最早猜中价格的玩家获得礼品。</textarea></td>
            </tr>
            <tr>
                <td class="item_title">节目图标:</td>
                <td class="item_input"><html:imgUpload name = 'ico_url' id='ico_url' /><span class='tip_span'></span></td>
            </tr>
            <tr>
                <td class="item_title">节目封面:</td>
                <td class="item_input"><html:imgUpload name = 'image_url' id='image_url' /><span class='tip_span'></span></td>
            </tr>
            <tr>
                <td class="item_title">开播时间提示:</td>
                <td class="item_input"><input type="text" class="textbox require" name="start_time_tip" size="45" /> 例如：每周一、三12:00和周日21:30</td>
            </tr>
            <!-- 2017-10-27 弃用,需求不需要这么复杂，自己搞复杂了 -->
            <tr>
                <td class="item_title">开播时间:</td>
                <td class="item_input">
                    <select name="start_cycle" required="required">
                        <option value="">==选择==</option>
                        <option value="week">每周</option>
                        <option value="day">每天</option>
                    </select>
                    <span id="cycle-detail"></span>
                </td>
            </tr>
            <tr>
                <td class="item_title">主持人ID:</td>
                <td class="item_input"><input type="text" class="textbox require" name="host_user_ids" value="100536 100537 100538" size="45" />多个主持人ID之间以空格隔开</td>
            </tr>
            <tr>
                <td class="item_title">主播ID:</td>
                <td class="item_input"><input type="text" class="textbox require" name="user_id" value="100535" />开直播房间的主播ID</td>
            </tr>
            <tr>
                <td class="item_title">排序:</td>
                <td class="item_input"><input type="text" class="textbox" name="sort" value="{$sort}" /></td>
            </tr>
            <tr>
                <td class="item_title"></td>
                <td class="item_input">
                    <!--隐藏元素-->
                    <input type="hidden" name="{:conf('VAR_MODULE')}" value="Xiacai" />
                    <input type="hidden" name="{:conf('VAR_ACTION')}" value="insert" />
                    <!--隐藏元素-->
                    <input type="submit" class="button" value="{%ADD}" />
                    <input type="reset" class="button" value="{%RESET}" />
                </td>
            </tr>
            <tr>
                <td colspan=2 class="bottomTd"></td>
            </tr>
        </table>
    </form>
</div>
<script>
    // 开播时间周期切换 2017-9-29
    $('[name="start_cycle"]').change(function () {
        var cycle = $(this).val();
        var inputs = '';
        switch (cycle) {
            case 'week':
                var weekdays = ['天','一', '二', '三', '四', '五', '六'];
                var n=0;
                for (var i = 1; i <= 7; i++) {
                    n=i;
                    if(n>6){
                        n=0;
                    }
                    inputs += '<span><input type="checkbox" name="weekday[]" value="' + n + '" />' + weekdays[n] + '<span style="display:none"><input type="text" name="start_time' + n + '" class="textbox" placeholder="HH:mm" size="4" /></span></span> ';
                }
                break;
            case 'day':
                inputs = '<input type="text" name="start_time" class="textbox" placeholder="HH:mm" size="4" />';
                break;
        }
        $('#cycle-detail').html(inputs);
    })
    $('#cycle-detail').delegate(':checkbox', 'click', function () {
        $(this).next().toggle();
    })
</script>
<include file="Public:footer" />